#ifndef SEARCHRESULTDELEGATE_H
#define SEARCHRESULTDELEGATE_H

class SearchResultDelegate : public QStyledItemDelegate
{
    Q_OBJECT
public:
    explicit SearchResultDelegate(QObject *parent = nullptr);

    //自定义代理必须重新实现以下4个函数

    //创建编辑组件
    // QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index)const override;

    // //从数据模型获取数据，显示到代理组件中
    // void setEditorData(QWidget *editor, const QModelIndex &index)const override;

    // //将代理组件的数据，保存到数据模型中
    // void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index)const override;

    // //更新代理编辑组件的大小
    // void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,const QModelIndex &index)const override;

    // QAbstractItemDelegate interface

public:
    void paint(QPainter *painter, const QStyleOptionViewItem &option,
               const QModelIndex &index) const override;
    QSize sizeHint(const QStyleOptionViewItem &option,
                   const QModelIndex &index) const override;
};


#endif // SEARCHRESULTDELEGATE_H
